package com.android.publicModule.webview.download;

import com.android.publicModule.network.DownloadProgress;

public class DownloadInfo {

	private String id;
	private String url;
	private String savePath;
	private DownloadProgress progress;
	private Object downloadInfo;
	private int percent;//已经下载的百分比0-100
	
	public DownloadInfo() {
		
	}

	public DownloadInfo(String id, String url, String savePath,
			DownloadProgress progress, Object downloadInfo) {
		this.id = id;
		this.url = url;
		this.savePath = savePath;
		this.progress = progress;
		this.downloadInfo = downloadInfo;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getSavePath() {
		return savePath;
	}

	public void setSavePath(String savePath) {
		this.savePath = savePath;
	}

	public DownloadProgress getProgress() {
		return progress;
	}

	public void setProgress(DownloadProgress progress) {
		this.progress = progress;
	}

	public Object getDownloadInfo() {
		return downloadInfo;
	}

	public void setDownloadInfo(Object downloadInfo) {
		this.downloadInfo = downloadInfo;
	}
	
	public int getPercent() {
		return percent;
	}

	public void setPercent(int percent) {
		this.percent = percent;
	}

	public boolean equals(Object downloadInfo) {
		boolean result = false;
		if(downloadInfo!=null&&downloadInfo instanceof DownloadInfo)
		{
			if(id!=null&&id.length()>0)
			{
				result = id.equals(((DownloadInfo)downloadInfo).getId());
			}
			else
			{
				if(url!=null)
				{
					result = url.equals(((DownloadInfo)downloadInfo).getUrl());
				}
				else
				{
					result = ((DownloadInfo)downloadInfo).getUrl()==null;
				}
			}
		}
		return result;
	}

}
